package com.jdk.demo.thread.atomic;

import java.util.concurrent.atomic.AtomicStampedReference;

import com.jdk.demo.thread.Person;

public class AtomicStampTest {
	
	public static void main(String[] args) {
		Person p1 = new Person(101);
		AtomicStampedReference<Person> p = new AtomicStampedReference<>(p1, 1);
		int stamp = p.getStamp();
		Person p2 = new Person(102);
		System.out.println(p.compareAndSet(p1, p2, stamp, stamp + 1));
	}

}
